import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:window_example/util/platform.dart';

import 'catalogue_page.dart';
import 'content_widget.dart';
import 'page_navigation_cubit.dart';

class WindowBodyWidget extends StatefulWidget {
  const WindowBodyWidget({super.key});

  @override
  State<WindowBodyWidget> createState() => _WindowBodyWidgetState();
}

class _WindowBodyWidgetState extends State<WindowBodyWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Row(
        mainAxisSize: MainAxisSize.max,
        children: [
          if (isDesktop()) CataloguePage(),
          if (isDesktop()) const SizedBox(width: 10),
          const Expanded(child: ContentWidget())
        ],
      ),
    );

    BlocProvider(
        create: (BuildContext context) => PageNavigationCubit(),
        child: Builder(
          builder: (context) => Row(
            mainAxisSize: MainAxisSize.max,
            children: [
              if (isDesktop()) CataloguePage(),
              const SizedBox(
                width: 10,
              ),
              const Expanded(child: ContentWidget())
            ],
          ),
        ));
  }
}
